package client.link;

import java.io.IOException;
import java.net.Socket;
import java.util.HashMap;

public class LinkUtil {
    public static final HashMap<String,Socket> cache = new HashMap<String,Socket>();
    
    
    public static Socket getLink(String ip, int port){
        String key = ip + ":" + port;
        Socket socket = cache.get(key);
        if(socket == null){
            try {
                socket = new Socket(ip, port);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return socket;
    }
}
